package com.wp.service.impl;

import com.wp.dao.StorageRecordDao;
import com.wp.entity.StorageRecord;
import com.wp.service.StorageRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class StorageRecordServiceImpl implements StorageRecordService {

    @Resource
    private StorageRecordDao storageRecordDao;

    @Override
    public List<StorageRecord> findRecordByPage(Integer pageIndex, Integer pageSize, String queryGoodsName, Integer querySupplierId, Integer querypayStatus) throws Exception {
        Integer from = (pageIndex-1)*pageSize;
        List<StorageRecord> list = storageRecordDao.queryUserRecordByPage(from,pageSize,queryGoodsName,querySupplierId,querypayStatus);
        return list;
    }

    @Override
    public Integer findRecordTotalCount(String queryGoodsName, Integer supplierId, Integer querypayStatus) {
        return storageRecordDao.queryRecordTotalCount(queryGoodsName,supplierId,querypayStatus);
    }

    @Override
    public int toAdd(StorageRecord storageRecord) {
        return storageRecordDao.toAdd(storageRecord);
    }

    @Override
    public StorageRecord findById(Integer id) {
        return storageRecordDao.findById(id);
    }

    @Override
    public int del(Integer id) {
        return storageRecordDao.del(id);
    }

    @Override
    public int upd(StorageRecord storageRecord) {
        return storageRecordDao.upd(storageRecord);
    }
}
